-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
-- build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
-- 根据系统选择build_command
local build_command
if package.config:sub(1, 1) == "\\" then
  build_command = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false"
else
  build_command = "make"
  -- build_command = "make BUILD_FROM_SOURCE=true"
end

return {
  {
    "yetone/avante.nvim",
    event = "VeryLazy",
    lazy = false,
    version = false, -- set this if you want to always pull the latest change
    opts = {
      provider = "siliconflow",
      system_prompt = "speak in Chinese",
      vendors = {
        deepseek = {
          __inherited_from = "openai",
          api_key_name = "DEEPSEEK_API_KEY",
          endpoint = "https://api.deepseek.com",
          model = "deepseek-chat",
          language = "Chinese",
          max_tokens = 32768,
        },
        siliconflow = {
          __inherited_from = "openai",
          api_key_name = "SILICONFLOW_API_KEY",
          endpoint = "https://api.siliconflow.com",
          model = "deepseek-ai/DeepSeek-V3",
          language = "Chinese",
          max_tokens = 32768,
          -- models = {
          --   "deepseek-ai/DeepSeek-V3",
          --   "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
          --   "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
          -- },
        },
        sf_qwen = {
          __inherited_from = "openai",
          api_key_name = "SILICONFLOW_API_KEY",
          endpoint = "https://api.siliconflow.com",
          model = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
          language = "Chinese",
          max_tokens = 32768,
        },
        -- siliconflow_qwen = {
        --   __inherited_from = "openai",
        --   api_key_name = "SILICONFLOW_API_KEY",
        --   endpoint = "https://api.siliconflow.com",
        --   model = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
        -- },
        -- moonshot = {
        --   __inherited_from = "openai",
        --   api_key_name = "MOONSHOT_API_KEY",
        --   endpoint = "https://api.moonshot.cn",
        --   model = "moonshot-v1-8k",
        -- },
      },
    },
    build = build_command,

    dependencies = {
      "nvim-treesitter/nvim-treesitter",
      "stevearc/dressing.nvim",
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      --- The below dependencies are optional,
      "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
      "zbirenbaum/copilot.lua", -- for providers='copilot'
      {
        -- support for image pasting
        "HakonHarnes/img-clip.nvim",
        event = "VeryLazy",
        opts = {
          -- recommended settings
          default = {
            embed_image_as_base64 = false,
            prompt_for_file_name = false,
            drag_and_drop = {
              insert_mode = true,
            },
            -- required for Windows users
            use_absolute_path = true,
          },
        },
      },
      {
        -- Make sure to set this up properly if you have lazy=true
        "MeanderingProgrammer/render-markdown.nvim",
        opts = {
          file_types = { "markdown", "Avante" },
        },
        ft = { "markdown", "Avante" },
      },
    },
  },
}
